Skip to content

Comments

Issue 128 rank mahalanobis#257

Merged
nullsatz merged 14 commits intomasterfrom
issue-128-rank-mahal-index
Jan 22, 2026
Merged

Issue 128 rank mahalanobis#257
nullsatz merged 14 commits intomasterfrom
issue-128-rank-mahal-index

Conversation

@benthestatistician
Copy link
Collaborator

Performance improvements for rank Mahalanobis calculations with a within argument to match_on. Another option for how to do the rank Mahalanobis calculation. #128

@benthestatistician benthestatistician linked an issue Jan 13, 2026 that may be closed by this pull request
3 tasks
@benthestatistician
Copy link
Collaborator Author

Not as ready as I thought it was... @nullsatz to look into test failures.

@nullsatz
Copy link
Collaborator

Not as ready as I thought it was... @nullsatz to look into test failures.

This one testthat test is failing. I'm pasting the output below.

Failure (test.rank.mahal.R:136:5): compute_pooled_cov_rank_mahalanobis results match ordinary Mahalanobis's
match_on(z ~ ., data = df, method = "pooled_cov") not equivalent to match_on(z ~ ., data = df, method = "mahalanobis").
Mean relative difference: 0.29986

[ FAIL 1 | WARN 0 | SKIP 0 | PASS 2042 ]

@benthestatistician
Copy link
Collaborator Author

That test still needs to be modified in accord with this comment to #128.

@nullsatz
Copy link
Collaborator

That test still needs to be modified in accord with this comment to #128.

Sorry @benthestatistician I missed that comment.

I have tried to implement your suggestion as follows and in the test, but I'm still getting the same error message.

    ## nr number of samples
    nr <- 10L
    z <- integer(nr)
    ## two outcomes: 0 (from initialization), and 1 (assigned below randomly)
    z[sample(1:nr, nr / 2L)] <- 1L 
        
    ## Goal: two groups with the same within-group variance and no rank ties
    df <- data.frame(z = z, X = integer(nr))
    df[df$z == 0, 'X'] <- seq(1, by=2, len = nr / 2)  # odds
    df[df$z == 1, 'X'] <- seq(2, by=2, len = nr / 2)  # evens

@benthestatistician
Copy link
Collaborator Author

See comment here

@benthestatistician
Copy link
Collaborator Author

Looks good to me!

@nullsatz nullsatz merged commit 036f04b into master Jan 22, 2026
6 checks passed
@nullsatz nullsatz deleted the issue-128-rank-mahal-index branch January 22, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compute_rank_mahalanobis ignores index argument

3 participants